<template>
	<view class="my-settle">
		<!-- 全选区域 -->
		  <label class="radio">
		    <radio @click="changeState" color="#C00000" :checked="isFullChecked" /><text>全选</text>
		  </label>
		
		  <!-- 合计区域 -->
		  <view class="amount-box">
		    合计:<text class="amount">￥{{allMoney}}</text>
		  </view>
		
		  <!-- 结算按钮 -->
		  <view class="btn-settle" @click="settleMent">结算({{checkCount}})</view>
	</view>
</template>

<script>
  import {mapGetters,mapMutations,mapState} from 'vuex'
	export default {
		data() {
			return {
				
			};
		},
    computed:{
        ...mapGetters('m_cart',['checkCount','allCount','allMoney']),
        ...mapGetters('m_address',['detail']),
        ...mapState('m_address',['token']),
        isFullChecked(){
          return this.checkCount==this.allCount?true:false
        }
    },
    methods:{
      ...mapMutations('m_cart',['stateAllChange']),
      changeState(){
        this.stateAllChange(!this.isFullChecked)
      },
      settleMent(){
        console.log(21);
        if(!this.checkCount)return uni.$showMsg('请勾选想要的商品')
        if(!this.detail) return uni.$showMsg('请填写收货地址')
        if(!this.token) return uni.$showMsg('请登录')
      }
    },

	}
</script>

<style lang="scss">
  .my-settle{
    position: fixed;
    height: 50px;
    width: 100%;
    bottom: 0;
    left: 0;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    .radio{
      margin-left: 10px;
      display: flex;
      align-items: center;
      radio{
        margin-right: 5px;
      }
    }
    .amount-box{
      .amount{
        color: #C00000;
        font-weight: bold;
      }
    }
    .btn-settle{
      background-color: #C00000;
      height: 50px;
      line-height: 50px;
      padding: 0 10px;
      color:white;
      min-width: 100px;
      text-align: center;
    }
  }
</style>
